#ifndef IMAGEENHANCETHREAD_H
#define IMAGEENHANCETHREAD_H

#include <QThread>

///@brief: Launch IeEnhancer
///@param[in] srcBuf: 需要增强的源图像的内存地址
///@param[in] destBuf: 增强后图像的存放内存地址
///@param[in] strRegion: 对应体位的配置文件所在目录，如"D:\\UserProgram\\8200\\config\\ChestAP.iee"，
///@                               则程序会到指定的目录下读取指定的配置文件
///@param[in] width: 需增强图像的宽度
///@param[in] height: 需增强图像的高度
///@param[in] bitDepth: 需增强图像的有效位数，依据客户的原始图像有效位数而定
///@usage: int ret = LaunchImageEnhancer_RAWnMem((void *)inBuf, (void *)outBuf, "D:\\UserProgram\\8200\\config\\ChestAP.iee", 3000, 3000, 14);
///@注意事项：对于有效位数8位的灰度图像，请使用short数据类型来存储像素值
typedef int (__stdcall *T_LaunchImageEnhancer_RAWnMem)(const ushort * srcBuf,
                                                       ushort * destBuf,
                                                       const char * strRegion,
                                                       const int width,
                                                       const int height,
                                                       const int bitDepth);

class ImageEnhanceThread : public QThread
{
    Q_OBJECT
public:
    explicit ImageEnhanceThread(QObject *parent = 0);

    void run() Q_DECL_OVERRIDE;

    void setIeLibPath(const QString &libPath);
    void setParams(const ushort *src, ushort *dest, const QString &iee, int w, int h, int bits)
    { m_src = src; m_dest = dest; m_iee = iee; m_w = w; m_h = h; m_bits = bits; }
    bool isLoaded() const { return LaunchImageEnhancer_RAWnMem != 0; }

signals:
    void resultReady(int ret, const QString &err);

public slots:

private:
    T_LaunchImageEnhancer_RAWnMem LaunchImageEnhancer_RAWnMem;

    const ushort *m_src;
    ushort *m_dest;
    QString m_iee;
    int m_w;
    int m_h;
    int m_bits;
    QString libDir;
};

#endif // IMAGEENHANCETHREAD_H
